import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/about',
    name: 'About',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }, {
    path: '/Index',
    name: 'Index',
    component: () => import('../views/Index.vue'),
    redirect: '/Control',
    children: [
      {
        path: '/Control',
        name: 'Control',
        component: () => import('../views/Control.vue'),
      },
      {
        path: '/CustomerManagement',
        name: 'CustomerManagement',
        component: () => import('../views/CustomerManagement.vue'),
      },
      {
        path: '/CRMIntelligence',
        name: 'CRMIntelligence',
        component: () => import('../views/CRMIntelligence.vue'),
      },
      {
        path: '/AccountManager',
        name: 'AccountManager',
        component: () => import('../views/AccountManager.vue'),
      },
    ]
  },
  {
    path: '/',
    name: 'Login',
    component: () => import('../views/Login.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
